package com.learn.tx.xml;

import org.springframework.jdbc.core.RowMapper;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * 《Spring源码深度解析》第10章 事务
 *  表与实体间的映射
 */
public class UserRowMapper implements RowMapper<Object> {
    @Override
    public Object mapRow(ResultSet set, int index) throws SQLException {
        User user = new User();
        user.setId(set.getInt("id"));
		user.setName(set.getString("name"));
		user.setAge(set.getInt("age"));
		user.setSex(set.getString("sex"));
        return user;
    }
}
